<?php

/**
 * This class is the generic exception raised by the BeObject framework.<br />
 * It allows user to filter on selection kind.
 */
class BeObjectException extends Exception {

  /**
   * Store the parameter in private of Exception class.<br />
   *
   * @param string $message The message of the exception.
   * @link http://be2.php.net/manual/en/class.exception.php
   * @link http://fr2.php.net/manual/en/function.is-string.php
   * @link http://be.php.net/manual/en/function.empty.php
   */
  public function __construct($message) {
    if (is_string($message) && !empty($message))
      $this->message = $message;
    else
      throw new IllegalArgumentException("The \$message parameter must be a string.");
  }

  /**
   * Returns a human readable stack trace on implicit casting to string.<br />
   * 
   * @return string Returns a human readable stack trace.<br />
   * @link http://be2.php.net/manual/en/reflectionfunction.tostring.php
   */
  public function __toString() {
    return $this->getMessage() . "\r\n\r\n" . $this->getTraceAsString();
  }

}
?>
